package com.example.feidaolumanager.api


import com.example.feidaolu.modal.Areas
import com.example.feidaolumanager.pojo.Agents
import com.example.feidaolumanager.pojo.LoginResult
import com.example.feidaolumanager.pojo.LoginVo
import com.example.feidaolumanager.pojo.MachineItem
import com.example.feidaolumanager.pojo.PageResult
import com.example.feidaolumanager.pojo.RegisterRequestBody
import com.example.feidaolumanager.pojo.ResponseDTO
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query

interface ApiService {

    companion object {
        const val BASE_URL = "http://120.79.24.109:8050"
//        const val BASE_URL = "http://192.168.101.124:8050"
    }

    @POST("/appuser/applogin")
    suspend fun login(@Body data:LoginVo):ResponseDTO<LoginResult>

    @POST("/appuser/appregistration")
    suspend fun register(@Body data: RegisterRequestBody): ResponseDTO<Boolean>

    @GET("/appuser/getagent")
    suspend fun getAgent(): ResponseDTO<Agents>

    @GET("/mechanics/getMechanics")
    suspend fun getMachineInfos(
        @Query("userid") ssId: Int,
        @Query("sel_key") selKey: Int?,
        @Query("sel_level") selLevel: Int?,
        @Query("page") page: Int? = 1,
        @Query("pageSize") pageSize: Int? = Int.MAX_VALUE,
    ): ResponseDTO<PageResult<MachineItem>>


    @GET("/areas/getAreas")
    suspend fun getAreas(
        @Header("token") apikey: String,
        @Query("id") id: Int
    ): ResponseDTO<Areas>
}